﻿# if UNITY_EDITOR

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(DefaultAsset))]
public class LuaFileEditor : Editor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        DefaultAsset a = target as DefaultAsset;
        if (a != null)
        {
            string path = AssetDatabase.GetAssetPath(a);
            if (path.EndsWith("lua"))
            {
                string luaText = System.IO.File.ReadAllText(path);
                if (!string.IsNullOrEmpty(luaText))
                    GUILayout.TextArea(luaText);
            }
        }
    }
}
#endif